package com.bohua.child.controller;

import com.bohua.child.common.Lay;
import com.bohua.child.common.Msg;
import com.bohua.child.entity.Mission;
import com.bohua.child.service.MissionService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
/**
 * 亲子任务控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2019/01/17
 */
@Controller
@RequestMapping("/mission")
public class MissionController {
    @Resource
    private MissionService missionService;

    @RequestMapping
    public String mission(){
        return "mission/mission.html";
    }
    @RequestMapping("/add")
    public String add(){
        return "mission/addMission.html";
    }

    @RequestMapping("/update")
    public String update(){
        return "mission/updateMission.html";
    }

    @RequestMapping("/getMissions")
    @ResponseBody
    public Lay getMissions(Mission mission,Integer page,Integer limit){
        return missionService.getMissions(mission,page,limit);
    }
    @RequestMapping("/addMission")
    @ResponseBody
    public Msg addMission(Mission mission){
        return missionService.addMission(mission);
    }

    @RequestMapping("/updateMission")
    @ResponseBody
    public Msg updateMission(Mission mission){
        return missionService.updateMission(mission);
    }

    @RequestMapping("/delMission")
    @ResponseBody
    public Msg delMission(Mission mission){
        return missionService.delMission(mission);
    }
}
